<?php
/**
 * Created by PhpStorm.
 * User: linlin
 * Date: 2017/3/27
 * Time: 11:43
 */
namespace Home\Controller;
use Think\Controller;
class NewsController extends Controller {
    /*CelebrationGrey zhoucong*/
    /*
     *
     *XXXX/index.php/Home/News/newsHomeShow
     * /
    /*首页新闻*/
    public function newsHomeShow(){
        $News = M("orui_news");
        $result = $News->order('new_datetime desc')->limit(1)->getField('new_id,new_content,new_img');
        var_dump($result);
    }
    /*新闻中心新闻*/
    /*
     * XXXX/index.php/Home/News/newsCenterShow
     */
    public function newsCenterShow(){
        $News = M('orui_news');
        $result = $News->order('new_datetime desc')->limit(6)->getField('new_id,new_tittle,new_datetime,new_img');
        var_dump($result);
    }

    /*新闻详情*/
    /*GET 方法 */
    /*
     * XXXX/index.php/Home/News/newDetails?new_id=1&new_word=2
     * XXXX/index.php/Home/News/newDetails/1&2
     */
    public  function  newsDetails(){
        $News = M('orui_news');
        if($_GET){
            $new_id = I("get.new_id",'intval');
            $conditions['new_id'] = $new_id;
            $result = $News->where($conditions)->select();
            $News->where($conditions)->setInc('new_watch_count');
        }
        else{
            $conditions['new_id'] = 1;
            $result = $News->where($conditions)->select();
            $News->where($conditions)->setInc('new_watch_count');
        }
        var_dump($result);
    }


    private  function  returnDate(){

    }
    /*CelebrationGrey zhoucong*/
}